/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.caresms.service.persistence;

import com.caresms.NoSuchSms_MasterException;

import com.caresms.model.Sms_Master;
import com.caresms.model.impl.Sms_MasterImpl;
import com.caresms.model.impl.Sms_MasterModelImpl;

import com.liferay.portal.NoSuchModelException;
import com.liferay.portal.kernel.bean.BeanReference;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InstanceFactory;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.ModelListener;
import com.liferay.portal.service.persistence.BatchSessionUtil;
import com.liferay.portal.service.persistence.ResourcePersistence;
import com.liferay.portal.service.persistence.UserPersistence;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The persistence implementation for the sms_ master service.
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author cc
 * @see Sms_MasterPersistence
 * @see Sms_MasterUtil
 * @generated
 */
public class Sms_MasterPersistenceImpl extends BasePersistenceImpl<Sms_Master>
	implements Sms_MasterPersistence {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. Always use {@link Sms_MasterUtil} to access the sms_ master persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
	 */
	public static final String FINDER_CLASS_NAME_ENTITY = Sms_MasterImpl.class.getName();
	public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
		".List1";
	public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
		".List2";
	public static final FinderPath FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID =
		new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_ENTITY, "fetchByFindSmsBycharsSize_User_Id",
			new String[] { Integer.class.getName(), Long.class.getName() },
			Sms_MasterModelImpl.SMS_CHARS_SIZE_COLUMN_BITMASK |
			Sms_MasterModelImpl.USERID_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_FINDSMSBYCHARSSIZE_USER_ID =
		new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"countByFindSmsBycharsSize_User_Id",
			new String[] { Integer.class.getName(), Long.class.getName() });
	public static final FinderPath FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_ENTITY, "fetchByFindSmsByUser_Id",
			new String[] { Long.class.getName() },
			Sms_MasterModelImpl.USERID_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_FINDSMSBYUSER_ID = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"countByFindSmsByUser_Id", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_ENTITY, "fetchByFindSmsByIsActive",
			new String[] { Boolean.class.getName() },
			Sms_MasterModelImpl.ISACTIVE_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_FINDSMSBYISACTIVE = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"countByFindSmsByIsActive", new String[] { Boolean.class.getName() });
	public static final FinderPath FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_ENTITY, "fetchByFindSmsByApproved_By",
			new String[] { Long.class.getName() },
			Sms_MasterModelImpl.APPROVED_BY_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_FINDSMSBYAPPROVED_BY = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"countByFindSmsByApproved_By", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_FIELD2 = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByField2",
			new String[] {
				Boolean.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2 =
		new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByField2",
			new String[] { Boolean.class.getName() },
			Sms_MasterModelImpl.FIELD2_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_FIELD2 = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByField2",
			new String[] { Boolean.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Sms_MasterImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
	public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);

	/**
	 * Caches the sms_ master in the entity cache if it is enabled.
	 *
	 * @param sms_Master the sms_ master
	 */
	public void cacheResult(Sms_Master sms_Master) {
		EntityCacheUtil.putResult(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterImpl.class, sms_Master.getPrimaryKey(), sms_Master);

		FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
			new Object[] {
				Integer.valueOf(sms_Master.getSms_chars_Size()),
				Long.valueOf(sms_Master.getUserId())
			}, sms_Master);

		FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
			new Object[] { Long.valueOf(sms_Master.getUserId()) }, sms_Master);

		FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
			new Object[] { Boolean.valueOf(sms_Master.getIsActive()) },
			sms_Master);

		FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
			new Object[] { Long.valueOf(sms_Master.getApproved_By()) },
			sms_Master);

		sms_Master.resetOriginalValues();
	}

	/**
	 * Caches the sms_ masters in the entity cache if it is enabled.
	 *
	 * @param sms_Masters the sms_ masters
	 */
	public void cacheResult(List<Sms_Master> sms_Masters) {
		for (Sms_Master sms_Master : sms_Masters) {
			if (EntityCacheUtil.getResult(
						Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
						Sms_MasterImpl.class, sms_Master.getPrimaryKey()) == null) {
				cacheResult(sms_Master);
			}
			else {
				sms_Master.resetOriginalValues();
			}
		}
	}

	/**
	 * Clears the cache for all sms_ masters.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	@Override
	public void clearCache() {
		if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
			CacheRegistryUtil.clear(Sms_MasterImpl.class.getName());
		}

		EntityCacheUtil.clearCache(Sms_MasterImpl.class.getName());

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	/**
	 * Clears the cache for the sms_ master.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	@Override
	public void clearCache(Sms_Master sms_Master) {
		EntityCacheUtil.removeResult(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterImpl.class, sms_Master.getPrimaryKey());

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

		clearUniqueFindersCache(sms_Master);
	}

	@Override
	public void clearCache(List<Sms_Master> sms_Masters) {
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

		for (Sms_Master sms_Master : sms_Masters) {
			EntityCacheUtil.removeResult(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
				Sms_MasterImpl.class, sms_Master.getPrimaryKey());

			clearUniqueFindersCache(sms_Master);
		}
	}

	protected void clearUniqueFindersCache(Sms_Master sms_Master) {
		FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
			new Object[] {
				Integer.valueOf(sms_Master.getSms_chars_Size()),
				Long.valueOf(sms_Master.getUserId())
			});

		FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
			new Object[] { Long.valueOf(sms_Master.getUserId()) });

		FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
			new Object[] { Boolean.valueOf(sms_Master.getIsActive()) });

		FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
			new Object[] { Long.valueOf(sms_Master.getApproved_By()) });
	}

	/**
	 * Creates a new sms_ master with the primary key. Does not add the sms_ master to the database.
	 *
	 * @param SmsId the primary key for the new sms_ master
	 * @return the new sms_ master
	 */
	public Sms_Master create(long SmsId) {
		Sms_Master sms_Master = new Sms_MasterImpl();

		sms_Master.setNew(true);
		sms_Master.setPrimaryKey(SmsId);

		return sms_Master;
	}

	/**
	 * Removes the sms_ master with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param SmsId the primary key of the sms_ master
	 * @return the sms_ master that was removed
	 * @throws com.caresms.NoSuchSms_MasterException if a sms_ master with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master remove(long SmsId)
		throws NoSuchSms_MasterException, SystemException {
		return remove(Long.valueOf(SmsId));
	}

	/**
	 * Removes the sms_ master with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param primaryKey the primary key of the sms_ master
	 * @return the sms_ master that was removed
	 * @throws com.caresms.NoSuchSms_MasterException if a sms_ master with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Sms_Master remove(Serializable primaryKey)
		throws NoSuchSms_MasterException, SystemException {
		Session session = null;

		try {
			session = openSession();

			Sms_Master sms_Master = (Sms_Master)session.get(Sms_MasterImpl.class,
					primaryKey);

			if (sms_Master == null) {
				if (_log.isWarnEnabled()) {
					_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
				}

				throw new NoSuchSms_MasterException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
					primaryKey);
			}

			return remove(sms_Master);
		}
		catch (NoSuchSms_MasterException nsee) {
			throw nsee;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	@Override
	protected Sms_Master removeImpl(Sms_Master sms_Master)
		throws SystemException {
		sms_Master = toUnwrappedModel(sms_Master);

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.delete(session, sms_Master);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		clearCache(sms_Master);

		return sms_Master;
	}

	@Override
	public Sms_Master updateImpl(com.caresms.model.Sms_Master sms_Master,
		boolean merge) throws SystemException {
		sms_Master = toUnwrappedModel(sms_Master);

		boolean isNew = sms_Master.isNew();

		Sms_MasterModelImpl sms_MasterModelImpl = (Sms_MasterModelImpl)sms_Master;

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.update(session, sms_Master, merge);

			sms_Master.setNew(false);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

		if (isNew || !Sms_MasterModelImpl.COLUMN_BITMASK_ENABLED) {
			FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
		}

		else {
			if ((sms_MasterModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Boolean.valueOf(sms_MasterModelImpl.getOriginalField2())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FIELD2, args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2,
					args);

				args = new Object[] {
						Boolean.valueOf(sms_MasterModelImpl.getField2())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FIELD2, args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2,
					args);
			}
		}

		EntityCacheUtil.putResult(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
			Sms_MasterImpl.class, sms_Master.getPrimaryKey(), sms_Master);

		if (isNew) {
			FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
				new Object[] {
					Integer.valueOf(sms_Master.getSms_chars_Size()),
					Long.valueOf(sms_Master.getUserId())
				}, sms_Master);

			FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
				new Object[] { Long.valueOf(sms_Master.getUserId()) },
				sms_Master);

			FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
				new Object[] { Boolean.valueOf(sms_Master.getIsActive()) },
				sms_Master);

			FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
				new Object[] { Long.valueOf(sms_Master.getApproved_By()) },
				sms_Master);
		}
		else {
			if ((sms_MasterModelImpl.getColumnBitmask() &
					FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Integer.valueOf(sms_MasterModelImpl.getOriginalSms_chars_Size()),
						Long.valueOf(sms_MasterModelImpl.getOriginalUserId())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FINDSMSBYCHARSSIZE_USER_ID,
					args);

				FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
					args);

				FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
					new Object[] {
						Integer.valueOf(sms_Master.getSms_chars_Size()),
						Long.valueOf(sms_Master.getUserId())
					}, sms_Master);
			}

			if ((sms_MasterModelImpl.getColumnBitmask() &
					FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Long.valueOf(sms_MasterModelImpl.getOriginalUserId())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FINDSMSBYUSER_ID,
					args);

				FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
					args);

				FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
					new Object[] { Long.valueOf(sms_Master.getUserId()) },
					sms_Master);
			}

			if ((sms_MasterModelImpl.getColumnBitmask() &
					FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Boolean.valueOf(sms_MasterModelImpl.getOriginalIsActive())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FINDSMSBYISACTIVE,
					args);

				FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
					args);

				FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
					new Object[] { Boolean.valueOf(sms_Master.getIsActive()) },
					sms_Master);
			}

			if ((sms_MasterModelImpl.getColumnBitmask() &
					FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Long.valueOf(sms_MasterModelImpl.getOriginalApproved_By())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_FINDSMSBYAPPROVED_BY,
					args);

				FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
					args);

				FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
					new Object[] { Long.valueOf(sms_Master.getApproved_By()) },
					sms_Master);
			}
		}

		return sms_Master;
	}

	protected Sms_Master toUnwrappedModel(Sms_Master sms_Master) {
		if (sms_Master instanceof Sms_MasterImpl) {
			return sms_Master;
		}

		Sms_MasterImpl sms_MasterImpl = new Sms_MasterImpl();

		sms_MasterImpl.setNew(sms_Master.isNew());
		sms_MasterImpl.setPrimaryKey(sms_Master.getPrimaryKey());

		sms_MasterImpl.setSmsId(sms_Master.getSmsId());
		sms_MasterImpl.setCompanyId(sms_Master.getCompanyId());
		sms_MasterImpl.setUserId(sms_Master.getUserId());
		sms_MasterImpl.setSmsContent(sms_Master.getSmsContent());
		sms_MasterImpl.setCreateDate(sms_Master.getCreateDate());
		sms_MasterImpl.setApproved_By(sms_Master.getApproved_By());
		sms_MasterImpl.setIsActive(sms_Master.isIsActive());
		sms_MasterImpl.setSms_chars_Size(sms_Master.getSms_chars_Size());
		sms_MasterImpl.setField1(sms_Master.getField1());
		sms_MasterImpl.setField2(sms_Master.isField2());
		sms_MasterImpl.setField3(sms_Master.getField3());
		sms_MasterImpl.setField4(sms_Master.getField4());
		sms_MasterImpl.setField5(sms_Master.getField5());

		return sms_MasterImpl;
	}

	/**
	 * Returns the sms_ master with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
	 *
	 * @param primaryKey the primary key of the sms_ master
	 * @return the sms_ master
	 * @throws com.liferay.portal.NoSuchModelException if a sms_ master with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Sms_Master findByPrimaryKey(Serializable primaryKey)
		throws NoSuchModelException, SystemException {
		return findByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Returns the sms_ master with the primary key or throws a {@link com.caresms.NoSuchSms_MasterException} if it could not be found.
	 *
	 * @param SmsId the primary key of the sms_ master
	 * @return the sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a sms_ master with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master findByPrimaryKey(long SmsId)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = fetchByPrimaryKey(SmsId);

		if (sms_Master == null) {
			if (_log.isWarnEnabled()) {
				_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + SmsId);
			}

			throw new NoSuchSms_MasterException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
				SmsId);
		}

		return sms_Master;
	}

	/**
	 * Returns the sms_ master with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param primaryKey the primary key of the sms_ master
	 * @return the sms_ master, or <code>null</code> if a sms_ master with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Sms_Master fetchByPrimaryKey(Serializable primaryKey)
		throws SystemException {
		return fetchByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Returns the sms_ master with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param SmsId the primary key of the sms_ master
	 * @return the sms_ master, or <code>null</code> if a sms_ master with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByPrimaryKey(long SmsId) throws SystemException {
		Sms_Master sms_Master = (Sms_Master)EntityCacheUtil.getResult(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
				Sms_MasterImpl.class, SmsId);

		if (sms_Master == _nullSms_Master) {
			return null;
		}

		if (sms_Master == null) {
			Session session = null;

			boolean hasException = false;

			try {
				session = openSession();

				sms_Master = (Sms_Master)session.get(Sms_MasterImpl.class,
						Long.valueOf(SmsId));
			}
			catch (Exception e) {
				hasException = true;

				throw processException(e);
			}
			finally {
				if (sms_Master != null) {
					cacheResult(sms_Master);
				}
				else if (!hasException) {
					EntityCacheUtil.putResult(Sms_MasterModelImpl.ENTITY_CACHE_ENABLED,
						Sms_MasterImpl.class, SmsId, _nullSms_Master);
				}

				closeSession(session);
			}
		}

		return sms_Master;
	}

	/**
	 * Returns the sms_ master where Sms_chars_Size = &#63; and userId = &#63; or throws a {@link com.caresms.NoSuchSms_MasterException} if it could not be found.
	 *
	 * @param Sms_chars_Size the sms_chars_ size
	 * @param userId the user ID
	 * @return the matching sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master findByFindSmsBycharsSize_User_Id(int Sms_chars_Size,
		long userId) throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = fetchByFindSmsBycharsSize_User_Id(Sms_chars_Size,
				userId);

		if (sms_Master == null) {
			StringBundler msg = new StringBundler(6);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("Sms_chars_Size=");
			msg.append(Sms_chars_Size);

			msg.append(", userId=");
			msg.append(userId);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			if (_log.isWarnEnabled()) {
				_log.warn(msg.toString());
			}

			throw new NoSuchSms_MasterException(msg.toString());
		}

		return sms_Master;
	}

	/**
	 * Returns the sms_ master where Sms_chars_Size = &#63; and userId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
	 *
	 * @param Sms_chars_Size the sms_chars_ size
	 * @param userId the user ID
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsBycharsSize_User_Id(int Sms_chars_Size,
		long userId) throws SystemException {
		return fetchByFindSmsBycharsSize_User_Id(Sms_chars_Size, userId, true);
	}

	/**
	 * Returns the sms_ master where Sms_chars_Size = &#63; and userId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
	 *
	 * @param Sms_chars_Size the sms_chars_ size
	 * @param userId the user ID
	 * @param retrieveFromCache whether to use the finder cache
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsBycharsSize_User_Id(int Sms_chars_Size,
		long userId, boolean retrieveFromCache) throws SystemException {
		Object[] finderArgs = new Object[] { Sms_chars_Size, userId };

		Object result = null;

		if (retrieveFromCache) {
			result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
					finderArgs, this);
		}

		if (result instanceof Sms_Master) {
			Sms_Master sms_Master = (Sms_Master)result;

			if ((Sms_chars_Size != sms_Master.getSms_chars_Size()) ||
					(userId != sms_Master.getUserId())) {
				result = null;
			}
		}

		if (result == null) {
			StringBundler query = new StringBundler(3);

			query.append(_SQL_SELECT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYCHARSSIZE_USER_ID_SMS_CHARS_SIZE_2);

			query.append(_FINDER_COLUMN_FINDSMSBYCHARSSIZE_USER_ID_USERID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(Sms_chars_Size);

				qPos.add(userId);

				List<Sms_Master> list = q.list();

				result = list;

				Sms_Master sms_Master = null;

				if (list.isEmpty()) {
					FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
						finderArgs, list);
				}
				else {
					sms_Master = list.get(0);

					cacheResult(sms_Master);

					if ((sms_Master.getSms_chars_Size() != Sms_chars_Size) ||
							(sms_Master.getUserId() != userId)) {
						FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
							finderArgs, sms_Master);
					}
				}

				return sms_Master;
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (result == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYCHARSSIZE_USER_ID,
						finderArgs);
				}

				closeSession(session);
			}
		}
		else {
			if (result instanceof List<?>) {
				return null;
			}
			else {
				return (Sms_Master)result;
			}
		}
	}

	/**
	 * Returns the sms_ master where userId = &#63; or throws a {@link com.caresms.NoSuchSms_MasterException} if it could not be found.
	 *
	 * @param userId the user ID
	 * @return the matching sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master findByFindSmsByUser_Id(long userId)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = fetchByFindSmsByUser_Id(userId);

		if (sms_Master == null) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("userId=");
			msg.append(userId);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			if (_log.isWarnEnabled()) {
				_log.warn(msg.toString());
			}

			throw new NoSuchSms_MasterException(msg.toString());
		}

		return sms_Master;
	}

	/**
	 * Returns the sms_ master where userId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
	 *
	 * @param userId the user ID
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsByUser_Id(long userId)
		throws SystemException {
		return fetchByFindSmsByUser_Id(userId, true);
	}

	/**
	 * Returns the sms_ master where userId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
	 *
	 * @param userId the user ID
	 * @param retrieveFromCache whether to use the finder cache
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsByUser_Id(long userId,
		boolean retrieveFromCache) throws SystemException {
		Object[] finderArgs = new Object[] { userId };

		Object result = null;

		if (retrieveFromCache) {
			result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
					finderArgs, this);
		}

		if (result instanceof Sms_Master) {
			Sms_Master sms_Master = (Sms_Master)result;

			if ((userId != sms_Master.getUserId())) {
				result = null;
			}
		}

		if (result == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_SELECT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYUSER_ID_USERID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(userId);

				List<Sms_Master> list = q.list();

				result = list;

				Sms_Master sms_Master = null;

				if (list.isEmpty()) {
					FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
						finderArgs, list);
				}
				else {
					sms_Master = list.get(0);

					cacheResult(sms_Master);

					if ((sms_Master.getUserId() != userId)) {
						FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
							finderArgs, sms_Master);
					}
				}

				return sms_Master;
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (result == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYUSER_ID,
						finderArgs);
				}

				closeSession(session);
			}
		}
		else {
			if (result instanceof List<?>) {
				return null;
			}
			else {
				return (Sms_Master)result;
			}
		}
	}

	/**
	 * Returns the sms_ master where isActive = &#63; or throws a {@link com.caresms.NoSuchSms_MasterException} if it could not be found.
	 *
	 * @param isActive the is active
	 * @return the matching sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master findByFindSmsByIsActive(boolean isActive)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = fetchByFindSmsByIsActive(isActive);

		if (sms_Master == null) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("isActive=");
			msg.append(isActive);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			if (_log.isWarnEnabled()) {
				_log.warn(msg.toString());
			}

			throw new NoSuchSms_MasterException(msg.toString());
		}

		return sms_Master;
	}

	/**
	 * Returns the sms_ master where isActive = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
	 *
	 * @param isActive the is active
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsByIsActive(boolean isActive)
		throws SystemException {
		return fetchByFindSmsByIsActive(isActive, true);
	}

	/**
	 * Returns the sms_ master where isActive = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
	 *
	 * @param isActive the is active
	 * @param retrieveFromCache whether to use the finder cache
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsByIsActive(boolean isActive,
		boolean retrieveFromCache) throws SystemException {
		Object[] finderArgs = new Object[] { isActive };

		Object result = null;

		if (retrieveFromCache) {
			result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
					finderArgs, this);
		}

		if (result instanceof Sms_Master) {
			Sms_Master sms_Master = (Sms_Master)result;

			if ((isActive != sms_Master.getIsActive())) {
				result = null;
			}
		}

		if (result == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_SELECT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYISACTIVE_ISACTIVE_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(isActive);

				List<Sms_Master> list = q.list();

				result = list;

				Sms_Master sms_Master = null;

				if (list.isEmpty()) {
					FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
						finderArgs, list);
				}
				else {
					sms_Master = list.get(0);

					cacheResult(sms_Master);

					if ((sms_Master.getIsActive() != isActive)) {
						FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
							finderArgs, sms_Master);
					}
				}

				return sms_Master;
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (result == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYISACTIVE,
						finderArgs);
				}

				closeSession(session);
			}
		}
		else {
			if (result instanceof List<?>) {
				return null;
			}
			else {
				return (Sms_Master)result;
			}
		}
	}

	/**
	 * Returns the sms_ master where Approved_By = &#63; or throws a {@link com.caresms.NoSuchSms_MasterException} if it could not be found.
	 *
	 * @param Approved_By the approved_ by
	 * @return the matching sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master findByFindSmsByApproved_By(long Approved_By)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = fetchByFindSmsByApproved_By(Approved_By);

		if (sms_Master == null) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("Approved_By=");
			msg.append(Approved_By);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			if (_log.isWarnEnabled()) {
				_log.warn(msg.toString());
			}

			throw new NoSuchSms_MasterException(msg.toString());
		}

		return sms_Master;
	}

	/**
	 * Returns the sms_ master where Approved_By = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
	 *
	 * @param Approved_By the approved_ by
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsByApproved_By(long Approved_By)
		throws SystemException {
		return fetchByFindSmsByApproved_By(Approved_By, true);
	}

	/**
	 * Returns the sms_ master where Approved_By = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
	 *
	 * @param Approved_By the approved_ by
	 * @param retrieveFromCache whether to use the finder cache
	 * @return the matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByFindSmsByApproved_By(long Approved_By,
		boolean retrieveFromCache) throws SystemException {
		Object[] finderArgs = new Object[] { Approved_By };

		Object result = null;

		if (retrieveFromCache) {
			result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
					finderArgs, this);
		}

		if (result instanceof Sms_Master) {
			Sms_Master sms_Master = (Sms_Master)result;

			if ((Approved_By != sms_Master.getApproved_By())) {
				result = null;
			}
		}

		if (result == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_SELECT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYAPPROVED_BY_APPROVED_BY_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(Approved_By);

				List<Sms_Master> list = q.list();

				result = list;

				Sms_Master sms_Master = null;

				if (list.isEmpty()) {
					FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
						finderArgs, list);
				}
				else {
					sms_Master = list.get(0);

					cacheResult(sms_Master);

					if ((sms_Master.getApproved_By() != Approved_By)) {
						FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
							finderArgs, sms_Master);
					}
				}

				return sms_Master;
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (result == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FINDSMSBYAPPROVED_BY,
						finderArgs);
				}

				closeSession(session);
			}
		}
		else {
			if (result instanceof List<?>) {
				return null;
			}
			else {
				return (Sms_Master)result;
			}
		}
	}

	/**
	 * Returns all the sms_ masters where field2 = &#63;.
	 *
	 * @param field2 the field2
	 * @return the matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public List<Sms_Master> findByField2(boolean field2)
		throws SystemException {
		return findByField2(field2, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the sms_ masters where field2 = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param field2 the field2
	 * @param start the lower bound of the range of sms_ masters
	 * @param end the upper bound of the range of sms_ masters (not inclusive)
	 * @return the range of matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public List<Sms_Master> findByField2(boolean field2, int start, int end)
		throws SystemException {
		return findByField2(field2, start, end, null);
	}

	/**
	 * Returns an ordered range of all the sms_ masters where field2 = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param field2 the field2
	 * @param start the lower bound of the range of sms_ masters
	 * @param end the upper bound of the range of sms_ masters (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public List<Sms_Master> findByField2(boolean field2, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_FIELD2;
			finderArgs = new Object[] { field2 };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_FIELD2;
			finderArgs = new Object[] { field2, start, end, orderByComparator };
		}

		List<Sms_Master> list = (List<Sms_Master>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Sms_Master sms_Master : list) {
				if ((field2 != sms_Master.getField2())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(2);
			}

			query.append(_SQL_SELECT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FIELD2_FIELD2_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(field2);

				list = (List<Sms_Master>)QueryUtil.list(q, getDialect(), start,
						end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first sms_ master in the ordered set where field2 = &#63;.
	 *
	 * @param field2 the field2
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master findByField2_First(boolean field2,
		OrderByComparator orderByComparator)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = fetchByField2_First(field2, orderByComparator);

		if (sms_Master != null) {
			return sms_Master;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("field2=");
		msg.append(field2);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSms_MasterException(msg.toString());
	}

	/**
	 * Returns the first sms_ master in the ordered set where field2 = &#63;.
	 *
	 * @param field2 the field2
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByField2_First(boolean field2,
		OrderByComparator orderByComparator) throws SystemException {
		List<Sms_Master> list = findByField2(field2, 0, 1, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last sms_ master in the ordered set where field2 = &#63;.
	 *
	 * @param field2 the field2
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master findByField2_Last(boolean field2,
		OrderByComparator orderByComparator)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = fetchByField2_Last(field2, orderByComparator);

		if (sms_Master != null) {
			return sms_Master;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("field2=");
		msg.append(field2);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchSms_MasterException(msg.toString());
	}

	/**
	 * Returns the last sms_ master in the ordered set where field2 = &#63;.
	 *
	 * @param field2 the field2
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching sms_ master, or <code>null</code> if a matching sms_ master could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master fetchByField2_Last(boolean field2,
		OrderByComparator orderByComparator) throws SystemException {
		int count = countByField2(field2);

		List<Sms_Master> list = findByField2(field2, count - 1, count,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the sms_ masters before and after the current sms_ master in the ordered set where field2 = &#63;.
	 *
	 * @param SmsId the primary key of the current sms_ master
	 * @param field2 the field2
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next sms_ master
	 * @throws com.caresms.NoSuchSms_MasterException if a sms_ master with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master[] findByField2_PrevAndNext(long SmsId, boolean field2,
		OrderByComparator orderByComparator)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = findByPrimaryKey(SmsId);

		Session session = null;

		try {
			session = openSession();

			Sms_Master[] array = new Sms_MasterImpl[3];

			array[0] = getByField2_PrevAndNext(session, sms_Master, field2,
					orderByComparator, true);

			array[1] = sms_Master;

			array[2] = getByField2_PrevAndNext(session, sms_Master, field2,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Sms_Master getByField2_PrevAndNext(Session session,
		Sms_Master sms_Master, boolean field2,
		OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_SMS_MASTER_WHERE);

		query.append(_FINDER_COLUMN_FIELD2_FIELD2_2);

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(field2);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(sms_Master);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Sms_Master> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the sms_ masters.
	 *
	 * @return the sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public List<Sms_Master> findAll() throws SystemException {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the sms_ masters.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of sms_ masters
	 * @param end the upper bound of the range of sms_ masters (not inclusive)
	 * @return the range of sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public List<Sms_Master> findAll(int start, int end)
		throws SystemException {
		return findAll(start, end, null);
	}

	/**
	 * Returns an ordered range of all the sms_ masters.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of sms_ masters
	 * @param end the upper bound of the range of sms_ masters (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public List<Sms_Master> findAll(int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = new Object[] { start, end, orderByComparator };

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
			finderArgs = FINDER_ARGS_EMPTY;
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
			finderArgs = new Object[] { start, end, orderByComparator };
		}

		List<Sms_Master> list = (List<Sms_Master>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;
			String sql = null;

			if (orderByComparator != null) {
				query = new StringBundler(2 +
						(orderByComparator.getOrderByFields().length * 3));

				query.append(_SQL_SELECT_SMS_MASTER);

				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);

				sql = query.toString();
			}
			else {
				sql = _SQL_SELECT_SMS_MASTER;
			}

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				if (orderByComparator == null) {
					list = (List<Sms_Master>)QueryUtil.list(q, getDialect(),
							start, end, false);

					Collections.sort(list);
				}
				else {
					list = (List<Sms_Master>)QueryUtil.list(q, getDialect(),
							start, end);
				}
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Removes the sms_ master where Sms_chars_Size = &#63; and userId = &#63; from the database.
	 *
	 * @param Sms_chars_Size the sms_chars_ size
	 * @param userId the user ID
	 * @return the sms_ master that was removed
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master removeByFindSmsBycharsSize_User_Id(int Sms_chars_Size,
		long userId) throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = findByFindSmsBycharsSize_User_Id(Sms_chars_Size,
				userId);

		return remove(sms_Master);
	}

	/**
	 * Removes the sms_ master where userId = &#63; from the database.
	 *
	 * @param userId the user ID
	 * @return the sms_ master that was removed
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master removeByFindSmsByUser_Id(long userId)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = findByFindSmsByUser_Id(userId);

		return remove(sms_Master);
	}

	/**
	 * Removes the sms_ master where isActive = &#63; from the database.
	 *
	 * @param isActive the is active
	 * @return the sms_ master that was removed
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master removeByFindSmsByIsActive(boolean isActive)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = findByFindSmsByIsActive(isActive);

		return remove(sms_Master);
	}

	/**
	 * Removes the sms_ master where Approved_By = &#63; from the database.
	 *
	 * @param Approved_By the approved_ by
	 * @return the sms_ master that was removed
	 * @throws SystemException if a system exception occurred
	 */
	public Sms_Master removeByFindSmsByApproved_By(long Approved_By)
		throws NoSuchSms_MasterException, SystemException {
		Sms_Master sms_Master = findByFindSmsByApproved_By(Approved_By);

		return remove(sms_Master);
	}

	/**
	 * Removes all the sms_ masters where field2 = &#63; from the database.
	 *
	 * @param field2 the field2
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByField2(boolean field2) throws SystemException {
		for (Sms_Master sms_Master : findByField2(field2)) {
			remove(sms_Master);
		}
	}

	/**
	 * Removes all the sms_ masters from the database.
	 *
	 * @throws SystemException if a system exception occurred
	 */
	public void removeAll() throws SystemException {
		for (Sms_Master sms_Master : findAll()) {
			remove(sms_Master);
		}
	}

	/**
	 * Returns the number of sms_ masters where Sms_chars_Size = &#63; and userId = &#63;.
	 *
	 * @param Sms_chars_Size the sms_chars_ size
	 * @param userId the user ID
	 * @return the number of matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public int countByFindSmsBycharsSize_User_Id(int Sms_chars_Size, long userId)
		throws SystemException {
		Object[] finderArgs = new Object[] { Sms_chars_Size, userId };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FINDSMSBYCHARSSIZE_USER_ID,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(3);

			query.append(_SQL_COUNT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYCHARSSIZE_USER_ID_SMS_CHARS_SIZE_2);

			query.append(_FINDER_COLUMN_FINDSMSBYCHARSSIZE_USER_ID_USERID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(Sms_chars_Size);

				qPos.add(userId);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FINDSMSBYCHARSSIZE_USER_ID,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of sms_ masters where userId = &#63;.
	 *
	 * @param userId the user ID
	 * @return the number of matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public int countByFindSmsByUser_Id(long userId) throws SystemException {
		Object[] finderArgs = new Object[] { userId };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FINDSMSBYUSER_ID,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYUSER_ID_USERID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(userId);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FINDSMSBYUSER_ID,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of sms_ masters where isActive = &#63;.
	 *
	 * @param isActive the is active
	 * @return the number of matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public int countByFindSmsByIsActive(boolean isActive)
		throws SystemException {
		Object[] finderArgs = new Object[] { isActive };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FINDSMSBYISACTIVE,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYISACTIVE_ISACTIVE_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(isActive);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FINDSMSBYISACTIVE,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of sms_ masters where Approved_By = &#63;.
	 *
	 * @param Approved_By the approved_ by
	 * @return the number of matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public int countByFindSmsByApproved_By(long Approved_By)
		throws SystemException {
		Object[] finderArgs = new Object[] { Approved_By };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FINDSMSBYAPPROVED_BY,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FINDSMSBYAPPROVED_BY_APPROVED_BY_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(Approved_By);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FINDSMSBYAPPROVED_BY,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of sms_ masters where field2 = &#63;.
	 *
	 * @param field2 the field2
	 * @return the number of matching sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public int countByField2(boolean field2) throws SystemException {
		Object[] finderArgs = new Object[] { field2 };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FIELD2,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_SMS_MASTER_WHERE);

			query.append(_FINDER_COLUMN_FIELD2_FIELD2_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(field2);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FIELD2,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of sms_ masters.
	 *
	 * @return the number of sms_ masters
	 * @throws SystemException if a system exception occurred
	 */
	public int countAll() throws SystemException {
		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
				FINDER_ARGS_EMPTY, this);

		if (count == null) {
			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(_SQL_COUNT_SMS_MASTER);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
					FINDER_ARGS_EMPTY, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Initializes the sms_ master persistence.
	 */
	public void afterPropertiesSet() {
		String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
					com.liferay.util.service.ServiceProps.get(
						"value.object.listener.com.caresms.model.Sms_Master")));

		if (listenerClassNames.length > 0) {
			try {
				List<ModelListener<Sms_Master>> listenersList = new ArrayList<ModelListener<Sms_Master>>();

				for (String listenerClassName : listenerClassNames) {
					listenersList.add((ModelListener<Sms_Master>)InstanceFactory.newInstance(
							listenerClassName));
				}

				listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
			}
			catch (Exception e) {
				_log.error(e);
			}
		}
	}

	public void destroy() {
		EntityCacheUtil.removeCache(Sms_MasterImpl.class.getName());
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	@BeanReference(type = Category_MasterPersistence.class)
	protected Category_MasterPersistence category_MasterPersistence;
	@BeanReference(type = City_MasterPersistence.class)
	protected City_MasterPersistence city_MasterPersistence;
	@BeanReference(type = Country_MasterPersistence.class)
	protected Country_MasterPersistence country_MasterPersistence;
	@BeanReference(type = Keyword_MasterPersistence.class)
	protected Keyword_MasterPersistence keyword_MasterPersistence;
	@BeanReference(type = Keyword_Sms_RelationPersistence.class)
	protected Keyword_Sms_RelationPersistence keyword_Sms_RelationPersistence;
	@BeanReference(type = Sms_MasterPersistence.class)
	protected Sms_MasterPersistence sms_MasterPersistence;
	@BeanReference(type = ResourcePersistence.class)
	protected ResourcePersistence resourcePersistence;
	@BeanReference(type = UserPersistence.class)
	protected UserPersistence userPersistence;
	private static final String _SQL_SELECT_SMS_MASTER = "SELECT sms_Master FROM Sms_Master sms_Master";
	private static final String _SQL_SELECT_SMS_MASTER_WHERE = "SELECT sms_Master FROM Sms_Master sms_Master WHERE ";
	private static final String _SQL_COUNT_SMS_MASTER = "SELECT COUNT(sms_Master) FROM Sms_Master sms_Master";
	private static final String _SQL_COUNT_SMS_MASTER_WHERE = "SELECT COUNT(sms_Master) FROM Sms_Master sms_Master WHERE ";
	private static final String _FINDER_COLUMN_FINDSMSBYCHARSSIZE_USER_ID_SMS_CHARS_SIZE_2 =
		"sms_Master.Sms_chars_Size = ? AND ";
	private static final String _FINDER_COLUMN_FINDSMSBYCHARSSIZE_USER_ID_USERID_2 =
		"sms_Master.userId = ?";
	private static final String _FINDER_COLUMN_FINDSMSBYUSER_ID_USERID_2 = "sms_Master.userId = ?";
	private static final String _FINDER_COLUMN_FINDSMSBYISACTIVE_ISACTIVE_2 = "sms_Master.isActive = ?";
	private static final String _FINDER_COLUMN_FINDSMSBYAPPROVED_BY_APPROVED_BY_2 =
		"sms_Master.Approved_By = ?";
	private static final String _FINDER_COLUMN_FIELD2_FIELD2_2 = "sms_Master.field2 = ?";
	private static final String _ORDER_BY_ENTITY_ALIAS = "sms_Master.";
	private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Sms_Master exists with the primary key ";
	private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Sms_Master exists with the key {";
	private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get(
				PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE));
	private static Log _log = LogFactoryUtil.getLog(Sms_MasterPersistenceImpl.class);
	private static Sms_Master _nullSms_Master = new Sms_MasterImpl() {
			@Override
			public Object clone() {
				return this;
			}

			@Override
			public CacheModel<Sms_Master> toCacheModel() {
				return _nullSms_MasterCacheModel;
			}
		};

	private static CacheModel<Sms_Master> _nullSms_MasterCacheModel = new CacheModel<Sms_Master>() {
			public Sms_Master toEntityModel() {
				return _nullSms_Master;
			}
		};
}